package com.yuan.ssm.util;

import com.yuan.ssm.constants.ResultConstants;
import com.yuan.ssm.vo.SNSResult;

public class SNSResultUtil {
	/**
	 * 得到成功的返回结果集
	 * 
	 * @return
	 */
	public static SNSResult<?> getSuccessResult() {
		return new SNSResult<>(ResultConstants.RESULT_SUCCESS);
	}

	/**
	 * 得到成功的返回结果集
	 * 
	 * @return
	 */
	public static <T> SNSResult<T> getSuccessResult(T t) {
		SNSResult<T> snsResult = new SNSResult<>();
		snsResult.setData(t);
		snsResult.setResult(ResultConstants.RESULT_SUCCESS);
		return snsResult;
	}
	/**
	 * 得到成功的返回结果集
	 * 
	 * @return
	 */
	public static SNSResult<Void> getErrorResult(String msg) {
		return new SNSResult<Void>(ResultConstants.RESULT_ERROR, msg);
	}
	/**
	 * 得到成功的返回结果集
	 * 
	 * @return
	 */
	public static SNSResult<Void> getErrorResult() {
		return getErrorResult("系统异常");
	}
}
